﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class TrainingCoursesQuotaBLL : ITrainingCoursesQuotaBLL
    {
        private static readonly ITrainingCoursesQuotaDAL dal = new TrainingCoursesQuotaDAL();
        ConvertNullable cn = new ConvertNullable();
        TrainingCoursesQuotaInfo info = new TrainingCoursesQuotaInfo();

        public IList<TrainingCoursesQuotaInfo> GetFull(string train_seq)
        {
            Nullable<int> ntrain_seq = cn.ConvertNullInt(train_seq);
            return dal.GetFull(ntrain_seq);
                
        }
        public IList<TrainingCoursesQuotaInfo> GetList(string course_quota_seq)
        {
            Nullable<int> quota_seq = cn.ConvertNullInt(course_quota_seq);
            return dal.GetList(quota_seq);
        }
        public void Insert(string Quota, int CourseSeq, string SiteSeq
            , Nullable<int> CreatedBy, Nullable<DateTime> CreatedWhen)
        {
            info.quota = Convert.ToInt32(Quota);
            info.train_seq = CourseSeq;
            info.job_site_seq = Convert.ToInt32(SiteSeq);
            info.created_by = CreatedBy;
            info.created_when = CreatedWhen;
            dal.Insert(info);
        }
        public void Update(int Sequence, string Quota, int CourseSeq, string SiteSeq
            , Nullable<int> UpdatedBy, Nullable<DateTime> UpdatedWhen)
        {
            info.course_quota_seq=Sequence;
            info.quota = Convert.ToInt32(Quota);
            info.train_seq = CourseSeq;
            info.job_site_seq = Convert.ToInt32(SiteSeq);
            info.updated_by = UpdatedBy;
            info.updated_when = UpdatedWhen;
            dal.Update(info);
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            dal.Delete(Sequence, UpdatedBy);
        }
    }
}
